import axios from 'axios';
const apiUrl = import.meta.env.VITE_API_BASE_URL;
const service = axios.create({
  baseURL: apiUrl,
  timeout: 10000,
  headers: {
    'Content-Type': 'application/json'
  }
});

// 添加请求拦截器
service.interceptors.request.use(config => {
  return config;
}, error => {
  return Promise.reject(error);
});

// 添加响应拦截器
service.interceptors.response.use(response => {
  return response.data;
}, error => {
  return Promise.reject(error);
});

export default service;